'use strict';
exports = module.exports = function( $scope, $alert, $uibModal ) {
    $scope.obj = {
        a01 : 60, a02 : 15, a03 : '123', a04 : '', a05 : "1496", a06 : "asdf", a07 : 1, a08 : '',
        a09 : 'wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww',
        a10 : 14, a11 : 30, a12 : 15.50, a13 : true, a14 : 0, a15 : "", a16 : [], agreement: false
    }
    $scope.a01changea02 = function(){
        if( $scope.a01 && $scope.a02 > 0 && $scope.a01 > $scope.a02){
            $scope.a02 = 15
        }
    };
    var x = [
        {"ID":1496,"Name":"x109698142(向延杰)"},{"ID":1568,"Name":"sm1111(郸仁辉)"},
        {"ID":10990,"Name":"doNameg891109(边国栋)"},{"ID":19633,"Name":"wwqzx9961(黄海锋)"}
    ];
    x.unshift({ID:"all",Name:"全部选择"});
    $scope.nameSource = x;
    $scope.a13change = function(){
        if( $scope.From.$invalid ) {
            $scope.From.submitted = true;
            console.log($scope.From.$error)
            $alert.error("请先填写表单,然后看情况")
            return
        }
        $scope.obj.a13 = !$scope.obj.a13
    };
    $scope.tinymceOptions = {
        plugins: 'pasteUpload link image code placeholder',
        menubar: false, //工具栏
        statusbar: false, //状态栏
        toolbar: 'undo redo | bold | alignleft aligncenter alignright alignjustify | outdent indent | underline'
    };
    //单张上传弹框
    $scope.clickone=function(){
        $uibModal.open({
            template:  '<!-- mulUp by liu -->'+
                '<div class="modal-header">'+
                    '<button class="close" ng-click="cancel()" type="button">&times;</button>'+
                    '<h4 class="modal-title">截图上传</h4>'+
                '</div>'+
                '<div class="modal-body" style="padding:15px 13px;">'+
                    '<div cropbbh get-my-obj="filepath2" get-my-fun="ok" width="750" height="400"></div>'+
                '</div>',
            controller: function( $scope, $uibModalInstance ) {
                $scope.ok=function(){
                    $uibModalInstance.close( );
                };
                $scope.cancel=function(){
                    $uibModalInstance.close();
                };
            },
            windowClass:'oneUploadChangeclass',
            backdrop: "true",
            size:"lg",
            resolve: { filepath2: function () { return $scope.filepath2; } }
        }).result.then(function (item) {
            if( ! item ) return;
            $scope.filepath2 = item;
        }, function () {});
    };
}